<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title></title>
</head>
<body>
<!--弹窗：编辑-->
<div th:fragment="tteacherinfoAddOrUpdate" class="modal inmodal fade" id="tteacherinfoAddOrUpdate_Modal"
     tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">编辑</h4>
                <small class="font-bold"></small>
            </div>
            <div class="modal-body">
                <form role="form" id="tteacherinfoAddOrUpdate_form">
                                                                        <input id="tteacherinfoAddOrUpdate_id" name="id"
                                   type="hidden">
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_createTime" name="createTime"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_createUserId" name="createUserId"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_isActive" name="isActive"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_remark" name="remark"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_sortNum" name="sortNum"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_updateTime" name="updateTime"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_updateUserId" name="updateUserId"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_version" name="version"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_auditPwd" name="auditPwd"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_confirmImgPath" name="confirmImgPath"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_idNo" name="idNo"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_name" name="name"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_namePy" name="namePy"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_signImgPath" name="signImgPath"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_workNo" name="workNo"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_wageNo" name="wageNo"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label></label> <input
                                    id="tteacherinfoAddOrUpdate_verSign" name="verSign"
                                    type="text" placeholder="" class="form-control"></div>
                                                                                                <div class="form-group"><label>签章ID</label> <input
                                    id="tteacherinfoAddOrUpdate_keysn" name="keysn"
                                    type="text" placeholder="签章ID" class="form-control"></div>
                                                            </form>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="tteacherinfoAddOrUpdateObj.submitHandler()">
                    保存
                </button>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        $(function () {
                tteacherinfoAddOrUpdateObj.myValidator = $('#tteacherinfoAddOrUpdate_form').validate({
                rules: tteacherinfoAddOrUpdateObj.dataRule,
                submitHandler: function (form) {
                        tteacherinfoAddOrUpdateObj.dataFormSubmit(form);
                }
            });
        })
        var tteacherinfoAddOrUpdateObj = new Object({
            myValidator: undefined,
            dataRule: {
                                                                            createTime:
                {
                    required: true
                }
                    ,                                                                createUserId:
                {
                    required: true
                }
                    ,                                                                isActive:
                {
                    required: true
                }
                    ,                                                                remark:
                {
                    required: true
                }
                    ,                                                                sortNum:
                {
                    required: true
                }
                    ,                                                                updateTime:
                {
                    required: true
                }
                    ,                                                                updateUserId:
                {
                    required: true
                }
                    ,                                                                version:
                {
                    required: true
                }
                    ,                                                                auditPwd:
                {
                    required: true
                }
                    ,                                                                confirmImgPath:
                {
                    required: true
                }
                    ,                                                                idNo:
                {
                    required: true
                }
                    ,                                                                name:
                {
                    required: true
                }
                    ,                                                                namePy:
                {
                    required: true
                }
                    ,                                                                signImgPath:
                {
                    required: true
                }
                    ,                                                                workNo:
                {
                    required: true
                }
                    ,                                                                wageNo:
                {
                    required: true
                }
                    ,                                                                verSign:
                {
                    required: true
                }
                    ,                                                                keysn:
                {
                    required: true
                }
                                                        },
        init: function (id) {
            if(id){
                $.myGet({
                    url: `/zzsys/tteacherinfo/info/${id}`,
                    success: function (data) {
                        if (data && data.code === 0) {
                            tteacherinfoAddOrUpdateObj.fillForm(data.data);
                        } else {
                            toastr.error(data.msg, '操作失败')
                        }
                    }
                })
            } else {
                tteacherinfoAddOrUpdateObj.fillForm();
            }
        }
        ,
        fillForm: function (data = {}) {
            let formArray = $("#tteacherinfoAddOrUpdate_form").serializeArray();
            for (let i in formArray) {
                if (formArray[i].name != 'type') {
                    $(`input[name|=\$\{formArray[i].name\}]`).val(data[formArray[i].name])
                }
            }
        }
        ,
        submitHandler: function () {
            $("#tteacherinfoAddOrUpdate_form").submit();
        }
        ,
        dataFormSubmit: function (form) {
            let formVals = $(form).serializeArray();
            let data = {}
            for (let i = 0; i < formVals.length; i++) {
                data[formVals[i].name] = formVals[i].value;
            }
            $.myPost({
                url: `/zzsys/tteacherinfo/${1 == 1 ? 'update' : 'save'}`,
                dataType: 'json',
                data: data,
                success: function (data) {
                    if (data && data.code === 0) {
                        toastr.success(data.msg, '操作提示')
                        $('#tteacherinfoAddOrUpdate_Modal').modal('hide')
                            tteacherinfoListObj.refreshDataList();
                            tteacherinfoAddOrUpdateObj.fillForm();
                    } else {
                        toastr.error(data.msg, '操作失败')
                    }
                }
            })
        }
        })
    </script>
</div>
</body>
</html>